<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <base th:href="${#request.getScheme()+'://'+#request.getServerName()+':'+#request.getServerPort()+#request.getContextPath()+'/'}">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>briup电子商务-我的收藏</title>
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">

    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/estore.js"></script>
    <script type="text/javascript" src="js/tongji.js"></script>


</head>
<body>
<div class="top" id="top">
    <div class="herf" th:if="${session.user} ==null">
        <span><a th:href="toLogin" href="login.html">登录</a></span>
        <span><a th:href="toRegister" href="register.html">注册</a></span>
    </div>
    <div class="herf" th:if="${session.user} !=null">
        <span>欢迎<a th:text="${session.user.loginName}" style="color: red;">李四</a></span>
        <span><a href="index.html" th:href="toIndex">首页</a></span>
        <span><a href="orders.html" th:href="toOrder">我的收藏</a></span>
        <span><a href="login.html" th:href="exit">退出</a></span>
    </div>
</div>

<!--头部-->
<div class="head">
    <div class="row clearfix">
        <div class="col-md-3 column">
            <img src="images/logo.png" class="logo">
        </div>
        <div class="col-md-6 column">
            <div class="input-group search">
                <input id="searchShopName" type="text" class="form-control" placeholder="请输入你要检索的书名"
                       style="padding: 20px">
                <span class="input-group-btn">
						<button class="btn btn-search" type="button" onclick="searchShop()"><span
                                class="glyphicon glyphicon-search"></span></button>
					</span>
            </div>
        </div>
        <div class="col-md-3 column bag">
            <a href="shopCar.html" th:href="toShopCar">
                <button class="btn btn-estore">
                    <span class="glyphicon glyphicon-shopping-cart"></span>&nbsp;购物车
                </button>
            </a>
        </div>
    </div>
</div>

<div class="nav">
    <div class="col-md-2 column  type" data-toggle="collapse"
         href="#typeMenu">我的收藏
    </div>
</div>

<div class="body">
    <div class="table-responsive collect-table">
        <div class="none" th:if="${collects.isEmpty()}">
            <h3>您目前还没收藏任何心仪的物品，快去<a href="list.html" th:href="searchShop">逛逛</a></h3>
        </div>
        <table class="table" th:if="${!collects.isEmpty()}">
            <thead>
            <tr class="row">

                <th>商品名</th>
                <th>是否特价</th>
                <th>价格</th>
                <th>缩略图</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="collect:${collects}" th:id="${collect.id}" class="row">

                <td><a th:text="${collect.shop.name}" href="viewShop.html"
                       th:href="'toViewShop?shopId='+${collect.shop.id}">一件商品</a></td>
                <td>
                    <span th:if="${collect.shop.discount}" class="glyphicon glyphicon-ok"></span>
                    <span th:if="${!collect.shop.discount}" class="glyphicon glyphicon-remove"></span>
                </td>

                <td th:text="${collect.shop.discountPrice}" th:if="${collect.shop.discount}">1</td>
                <td th:text="${collect.shop.sellingPrice}" th:if="${!collect.shop.discount}">1</td>
                <td><img src="images/shop/no-img.png" th:src="${application.path}+'goods/'+${collect.shop.img}"></td>
                <td>
                    <button class="btn btn-warning" onclick="" th:onclick="'delCollect('+${collect.id}+')'">取消收藏
                    </button>
                </td>
            </tbody>
        </table>
    </div>
</div>
<!--脚部-->

<div class="footer">
    <div class="row clearfix icons">
        <div class="col-md-3 column">
            <img src="images/icons/icon_1_17.png">
            品目繁多 愉悦购物
        </div>
        <div class="col-md-3 column">
            <img src="images/icons/icon_1_20.png">
            正品保障 天天低价
        </div>
        <div class="col-md-3 column">
            <img src="images/icons/icon_1_23.png">
            极速物流 特色定制
        </div>
        <div class="col-md-3 column">
            <img src="images/icons/icon_1_25.png">
            优质服务 以客为尊
        </div>
    </div>
    <div class="links">
        <p>
            <span>关于我们</span>|
            <span>联系我们</span>|
            <span>加我我们</span>|
            <span>友情链接</span>
        </p>
        <p>沪ICP备14033591号-8 杰普briup.com版权所有 杰普软件科技有限公司</p>

    </div>
</div>
</body>
</html>
<script type="text/javascript">
    function delCollect(collectId) {
        var tr = $('#' + collectId);

        console.log(tr)
        $.ajax({
            type: 'get',
            url: 'delCollect?collectId=' + collectId,
            success: function () {
                tr.hide()
                alert("取消收藏成功")

            },
            error: function () {
                alert("取消收藏失败")
            },
        })

    }
</script>